# $Id: PKGBUILD 151284 2012-02-25 12:42:20Z pierre $
# Maintainer: AndyRTR <andyrtr@archlinux.org>

pkgname=opengl-man-pages
_svndate=20120225
pkgver=0.${_svndate}
pkgrel=1
pkgdesc="OpenGL Man Pages"
arch=('any')
url="http://www.opengl.org/wiki/Getting_started/XML_Toolchain_and_Man_Pages"
license=('custom')
makedepends=('libxslt' 'docbook-xsl' 'w3c-mathml2' 'docbook-mathml')
options=('!makeflags')
source=("ftp://ftp.archlinux.org/other/${pkgname}/${pkgname}_${_svndate}.tar.xz"
        'LICENSE')
md5sums=('15429a947576e424b96956680c0e9e4c'
         'cb856abe5968300057e650096ba25b2f')

# source PKGBUILD && mksource
mksource() {
  mkdir ${pkgname}-source
  pushd ${pkgname}-source
  svn co --username anonymous --password anonymous https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/docs/man/ man 
  find man -depth -type d -name .svn -exec rm -rf {} \;
  tar -cvJf ../${pkgname}_${_svndate}.tar.xz man/*
  popd
}

build() {
  cd "${srcdir}/man"
  export ROOT="${srcdir}/man"
  make
  for file in *.xml; do
    xsltproc --noout --nonet /usr/share/xml/docbook/xsl-stylesheets-1.76.1/manpages/docbook.xsl ${file}
  done
}

package() {
  cd "${srcdir}/man"
  install -d "${pkgdir}/usr/share/man/man3"
  install -m644 *.3G "${pkgdir}/usr/share/man/man3/"
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
